package com.lwt.hospital.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;

import java.util.Objects;

/**
 * @author 丁兆顺
 * @date 2020/5/18 0:28
 * @desciption
 */


public class User {

    @TableId(type = IdType.AUTO)
    private long id;
    private String card;
    private String name;
    private String sex;
    private int age;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getCard() {
        return card;
    }

    public void setCard(String card) {
        this.card = card;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    private String phone;
    private String password;
    private String address;
    @TableField(exist = false)
    //用来从前台接收登录信息
    private String account;

    public int getIdentity() {
        return identity;
    }

    public void setIdentity(int identity) {
        this.identity = identity;
    }

    @TableField(exist = false)
    // 用来识别登录什么类型的账号 1-普通用户  2-医护人员  3-管理员
    private int identity;

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass() || o instanceof User) {
            return false;
        }
        User user = (User) o;

        return card.equals(user.card) && this.phone.equals(user.phone);
    }

    @Override
    public int hashCode() {
        return Objects.hash(card, password);
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", card='" + card + '\'' +
                ", name='" + name + '\'' +
                ", sex='" + sex + '\'' +
                ", age=" + age +
                ", phone='" + phone + '\'' +
                ", password='" + password + '\'' +
                ", address='" + address + '\'' +
                ", account='" + account + '\'' +
                ", identity=" + identity +
                '}';
    }
}
